package com.sunwayworld.basemodule.business.prefolder.resource.impl;

import com.sunwayworld.basemodule.business.prefolder.bean.LimsPreFolderBean;
import com.sunwayworld.basemodule.business.prefolder.resource.LimsPreFolderResource;
import com.sunwayworld.basemodule.business.prefolder.service.LimsPreFolderService;
import com.sunwayworld.basemodule.business.prefolder.validators.LimsOperationBatchSubmitValidator;
import com.sunwayworld.basemodule.samplemanage.sample.bean.LimsSampleDerivativeBean;
import com.sunwayworld.basemodule.samplemanage.sample.service.LimsSampleDerivativeService;
import com.sunwayworld.framework.data.page.Page;
import com.sunwayworld.framework.log.annotation.Log;
import com.sunwayworld.framework.log.annotation.LogModule;
import com.sunwayworld.framework.log.annotation.LogType;
import com.sunwayworld.framework.restful.data.RestJsonWrapperBean;
import com.sunwayworld.framework.spring.annotation.GikamBean;
import com.sunwayworld.framework.validator.data.annotation.ValidateDataWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@LogModule("任务下发")
@RestController
@GikamBean
public class LimsPreFolderResourceImpl implements LimsPreFolderResource {

    @Autowired
    private LimsPreFolderService limsPreFolderService;

    @Autowired
    private LimsSampleDerivativeService derivativeService;

    @Override
    public LimsPreFolderService getService() {
        return limsPreFolderService;
    }

    @Log(value = "新增任务下发", type = LogType.INSERT)
    @Override
    @RequestMapping(method = RequestMethod.POST)
    public Long insert(RestJsonWrapperBean wrapper) {
        return getService().insert(wrapper);
    }

    @Log("提交")
    @Override
    public void submit(RestJsonWrapperBean wrapperBean) {
        getService().submit(wrapperBean);
    }

    @Log("历史任务下发")
    @Override
    public void issueOfHistoricalTasks(RestJsonWrapperBean wrapperBean) {
        getService().issueOfHistoricalTasks(wrapperBean);
    }

    @Log("混样历史任务选择")
    @Override
    public Page<LimsSampleDerivativeBean> selectMixTask(RestJsonWrapperBean wrapperBean) {
        return derivativeService.selectMixTask(wrapperBean);
    }

    @Log("混样历史任务下发")
    @Override
    public void issueOfMixTask(RestJsonWrapperBean wrapperBean) {
        getService().issueOfMixTask(wrapperBean);
    }

    @Override
    public Page<LimsPreFolderBean> selectIssueSamplePagination(RestJsonWrapperBean wrapper) {
        return getService().selectIssueSamplePagination(wrapper);
    }

    @Override
    public void addOperationBatchTasks(RestJsonWrapperBean wrapper) {
        getService().addOperationBatchTasks(wrapper);
    }

    @Override
    public void removeOperationBatchTasks(RestJsonWrapperBean wrapper) {
        getService().removeOperationBatchTasks(wrapper);
    }

    @Override
    @ValidateDataWith(LimsOperationBatchSubmitValidator.class)
    public void submitOperationBatch(RestJsonWrapperBean wrapper) {
        getService().submitOperationBatch(wrapper);
    }

    @Override
    public void separateSample(RestJsonWrapperBean wrapper) {
        //getService().separateSample(wrapper);
        getService().splitSample(wrapper);
    }

    @Log("终止")
    @Override
    public void stop(RestJsonWrapperBean wrapperBean) {
        getService().stop(wrapperBean);
    }

    @Override
    public Page<LimsPreFolderBean> selectForHistory(RestJsonWrapperBean wrapper) {
        return getService().selectForHistory(wrapper);
    }

    @Override
    public void remove(RestJsonWrapperBean wrapperBean) {
        getService().remove(wrapperBean);
    }
}

